from selenium.webdriver.common.by import By
from common.Utils import oj_driver

# 进行整体的题目列表界面


class OJ:
    url = ""
    driver = ""

    def __init__(self):
        self.url = "http://111.230.81.226:8080/index.html"
        self.driver = oj_driver.driver

    # 正确进入后的场景
    def OJSuccess(self):
        # 如果是正确登录，那么此时界面上应该有对应的内容信息
        self.driver.find_element(By.CSS_SELECTOR, "body > div > div.question_list > table > tbody > tr:nth-child(2) > "
                                                  "td:nth-child(2) > a").click()
        # 看看按钮在不在，点击一下
        self.driver.find_element(By.CSS_SELECTOR, "body > div > div.part2 > button").click()
        # 查看错误信息是否正确
        value = self.driver.find_element(By.CSS_SELECTOR, "body > div > div.part2 > div > p").text
        assert (value == "未知错误")
        oj_driver.getScreenShot()